Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add etherscan function to ignore/remove unused contracts #247

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

rmi7
Copy link
Contributor

@rmi7 rmi7 commented Mar 17, 2022

fixes #246

@rmi7 rmi7 requested a review from montyly March 17, 2022 16:32
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing this to != will make the mypy error go away. But then pylint will error saying it needs to be is not..

Comment on lines +420 to +433
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
base_path = file_path.replace(file_ast["absolutePath"], "")
break

if root_file_path is None:
# we could not find a contract with that name in any of the files
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
root_file_path = None
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if root_file_path is not None: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
base_path = file_path.replace(file_ast["absolutePath"], "")
break
if root_file_path is None:
# we could not find a contract with that name in any of the files
return
root_file_path = None
found = False
base_path = ""
for file_path, file_ast in compilation_unit.asts.items():
if found: # already found target contract
break
for node in file_ast["nodes"]:
if node["nodeType"] == "ContractDefinition" and node["name"] == root_contract_name:
root_file_path = file_path
found = True
base_path = file_path.replace(file_ast["absolutePath"], "")
break
if not found:
# we could not find a contract with that name in any of the files
return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants